const jsonwebtoken = require("jsonwebtoken")
const script = require("../config/config.js").script

const JWT = {
    //生成token
    crateJWT: (value, expriers) => {
        return jsonwebtoken.sign(value, script, { expiresIn: "1d" })
    },
    verifyJWT: (token,) => {
        try {
            return jsonwebtoken.verify(token, script)
        } catch (error) {
            console.log(error.message, '错误信息')
            return false
        }
    }
}
module.exports = JWT